<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateNewsTable extends Migration
{
    /**
     * Run sthe migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('news', function (Blueprint $table) {
            $table->id();
            $table->string('title', 255)->comment('新闻标题');
            $table->string('title_alias', 255)->comment('别名');
            $table->string('head_img', 255)->comment('头图');
            $table->unsignedBigInteger('author_id')->comment('作者id');
            $table->unsignedBigInteger('news_class_id_root')->nullable()->comment('新闻顶分类id');
            $table->unsignedBigInteger('news_class_id')->comment('新闻分类id');
            $table->mediumInteger('like_times')->default(0)->comment('点赞数');
            $table->mediumInteger('share_times')->default(0)->comment('分享数');
            $table->mediumInteger('view_times')->default(0)->comment('浏览量');
            $table->mediumInteger('collect_times')->default(0)->comment('收藏数');
            $table->string('tags')->nullable()->comment('标签');
            $table->longText('content')->comment('内容');
            $table->tinyInteger('is_elite')->default(0)->comment('是否加精0=否 1=是');
            $table->tinyInteger('status')->default(0)->comment('状态：0-下线；1-上线；2-待审核；3-审核中；4-审核成功；5-审核失败；');
            $table->tinyInteger('sort')->default(0)->comment('排序');
            $table->tinyInteger('source')->default(1)->comment('来源1-管理端；2=商家端');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('news');
    }
}
